```
<template>
    <div class="home-wrap">
        <!-- 子路由渲染区域（课程详情等）- 不需要侧边栏的页面 -->
        <router-view v-if="!showSidebar"></router-view>
        
        <!-- 带侧边栏的布局 -->
        <div class="home-function" v-else>
            <div class="home-sidebar home-common">
                <a-menu :selected-keys="selectedKeys" @menu-item-click="toLink">
                    <a-menu-item v-for="item in navList" :key="item.key">
                        <template #icon>
                            <component :is="item.icon" />
                        </template>
                        {{ item.label }}
                    </a-menu-item>
                </a-menu>
            </div>
            
            <!-- 内容区 -->
            <div class="home-content home-common">
                <!-- 子路由渲染区域 -->
                <router-view></router-view>
                
                <!-- 静态登录主页内容 -->
                <div class="landing-content" v-if="$route.path === '/home'">
                    <!-- 英雄区域 -->
                    <section class="hero">
                        <div class="hero-content">
                            <h1 class="hero-title">欢迎来到学了么</h1>
                            <p class="hero-description">
                                专业的在线学习平台，为您提供全面的课程学习、题库练习、考试测评等服务。
                                无论您是学生还是职场人士，都能在这里找到适合您的学习资源。
                            </p>
                            <div class="hero-actions">
                                <router-link to="/login" class="btn btn-primary">立即登录</router-link>
                                <router-link to="/home/course/student" class="btn btn-secondary">开始学习</router-link>
                            </div>
                        </div>
                        <div class="hero-image">
                            <div class="placeholder-image">
                                <span class="image-text">学习平台展示图</span>
                            </div>
                        </div>
                    </section>

                    <!-- 功能特性区域 -->
                    <section class="features">
                        <h2 class="section-title">核心功能</h2>
                        <div class="features-grid">
                            <div class="feature-card">
                                <div class="feature-icon">📚</div>
                                <h3>课程中心</h3>
                                <p>丰富的课程资源，涵盖各个学科领域，支持在线学习和进度跟踪。</p>
                            </div>
                            <div class="feature-card">
                                <div class="feature-icon">📝</div>
                                <h3>题库中心</h3>
                                <p>海量题库资源，支持智能组卷、错题本管理，助力高效学习。</p>
                            </div>
                            <div class="feature-card">
                                <div class="feature-icon">🎯</div>
                                <h3>考试中心</h3>
                                <p>在线考试系统，支持自动批阅、成绩分析，提供完整的考试体验。</p>
                            </div>
                            <div class="feature-card">
                                <div class="feature-icon">💬</div>
                                <h3>交流中心</h3>
                                <p>学习社区功能，支持问答互动、经验分享，构建学习生态圈。</p>
                            </div>
                        </div>
                    </section>

                    <!-- 使用流程区域 -->
                    <section class="workflow">
                        <h2 class="section-title">使用流程</h2>
                        <div class="workflow-steps">
                            <div class="step">
                                <div class="step-number">1</div>
                                <h3>注册登录</h3>
                                <p>创建账户并登录系统</p>
                            </div>
                            <div class="step">
                                <div class="step-number">2</div>
                                <h3>选择课程</h3>
                                <p>浏览并选择感兴趣的课程</p>
                            </div>
                            <div class="step">
                                <div class="step-number">3</div>
                                <h3>开始学习</h3>
                                <p>参与课程学习和练习</p>
                            </div>
                            <div class="step">
                                <div class="step-number">4</div>
                                <h3>参加考试</h3>
                                <p>检验学习成果</p>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </div>
        
        <div class="footer">
            <p>
                <a href="https://gitee.com/baymaxsjj">&copy; 2025 学了么 版权所有<br /></a>
            </p>
        </div>
    </div>
</template>

<script setup>
import { useRouter, useRoute } from 'vue-router'
import { ref, shallowRef, watchEffect, computed } from 'vue'
import { Menu } from '@arco-design/web-vue'
import { 
    IconUser, 
    IconGift, 
    IconCalendar, 
    IconSchedule, 
    IconStar, 
    IconBook,
    IconHome,
    IconBookmark,
    IconQuestionCircle,
    IconExperiment
} from '@arco-design/web-vue/es/icon'
import useUserStore from '../../sotre/user-store'

const router = useRouter()
const route = useRoute()
const userStore = useUserStore()

// 检查登录状态
const checkLogin = () => {
    if (!userStore.isLogin) {
        router.push('/login')
    }
}

// 判断是否显示侧边栏（课程页面不显示）
const showSidebar = computed(() => {
    return !route.path.startsWith('/course/')
})

// 判断是否为会员页面
const isMemberPage = computed(() => {
    return route.path.startsWith('/member')
})

// 侧边栏相关逻辑
const selectedKeys = ref([])
const navList = shallowRef([])

// 菜单列表
const homeList = [
    { key: '/home', label: '首页', icon: IconHome },
    { key: '/home/course/student', label: '课程中心', icon: IconBookmark },
    { key: '/communication', label: '交流中心', icon: IconQuestionCircle },
    { key: '/member/center', label: '会员中心', icon: IconGift }
]

const memberList = [
    { key: '/member/center', label: '会员信息', icon: IconUser },
    { key: '/member/benefits', label: '会员权益', icon: IconGift },
    { key: '/member/weekly-plan-intro', label: '周计划', icon: IconCalendar },
    { key: '/member/course-schedule-intro', label: '课表', icon: IconSchedule },
    { key: '/member/habit-21-intro', label: '21天习惯', icon: IconStar },
    { key: '/member/tutorial', label: '使用教程', icon: IconBook }
]

// 检查导航
const checkNav = () => {
    const currentPath = route.path
    
    // 设置菜单列表
    if (isMemberPage.value) {
        navList.value = memberList
    } else {
        navList.value = homeList
    }
    
    // 设置选中项
    selectedKeys.value = [currentPath]
}

// 路由跳转
const toLink = ({ key }) => {
    router.push(key)
}

// 监听路由变化
watchEffect(() => {
    checkNav()
})

checkLogin()
</script>

<style lang="less" scoped>
/* 静态登录主页内容样式 */
.landing-content {
  padding: 20px;
}

/* 英雄区域样式 */
.hero {
  padding: 60px 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  margin-bottom: 40px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  padding: 40px;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.2;
}

.hero-description {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 30px;
  opacity: 0.9;
}

.hero-actions {
  display: flex;
  gap: 16px;
}

.btn {
  padding: 12px 24px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: #fff;
  color: #165dff;
}

.btn-secondary {
  background: transparent;
  color: #fff;
  border: 1px solid #fff;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.placeholder-image {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(255, 255, 255, 0.3);
}

.image-text {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
}

/* 功能特性样式 */
.features {
  padding: 60px 0;
  background: #f8f9fa;
  border-radius: 12px;
  margin-bottom: 40px;
}

.section-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 40px;
  color: #1a1a1a;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  padding: 0 20px;
}

.feature-card {
  background: white;
  padding: 25px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 15px;
}

.feature-card h3 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  color: #1a1a1a;
}

.feature-card p {
  color: #666;
  line-height: 1.6;
}

/* 使用流程样式 */
.workflow {
  padding: 60px 0;
  border-radius: 12px;
  background: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  padding: 0 20px;
}

.step {
  text-align: center;
}

.step-number {
  width: 50px;
  height: 50px;
  background: #165dff;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 auto 15px;
}

.step h3 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: #1a1a1a;
}

.step p {
  color: #666;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 30px 20px;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-actions {
    justify-content: center;
  }
  
  .features-grid,
  .workflow-steps {
    grid-template-columns: 1fr;
  }
}
</style>